UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3Ux9JthyprO4pjoq8msOuvu/VW4NZtT4TyBkcapLaSw=' 
WHERE 
  key_id = '7c8a061f0c0501d734a3f7d16d4daeab3e3139cdaf0f81b0b302960384c18081' 
  AND (
    token = '3Ux9JthyprO4pjoq8msOuvu/VW4NZtT4TyBkcapLaSw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032