UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y314CIabjLaa1tGp6Jow01S7XtfdQx8F2E0ha0dmhdk=' 
WHERE 
  key_id = '1075ef771dacc17eae2a1d7de6fb279b31825fa2bc291d72572618c51756c92c' 
  AND (
    token = 'Y314CIabjLaa1tGp6Jow01S7XtfdQx8F2E0ha0dmhdk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016