UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Fsy2RISYVSlgnr2LT5DZhA0ks/cJqiVrhUcUrbt/qvk=' 
WHERE 
  key_id = '01730c65d7d97861269739d27aadf9d4d5406a2010f6746a5860587000846c8b' 
  AND (
    token = 'Fsy2RISYVSlgnr2LT5DZhA0ks/cJqiVrhUcUrbt/qvk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031