UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RFYU5b3+mt29xzhJ4o80bqjCm3dZbsMAmB+JmOnd/eo=' 
WHERE 
  key_id = 'f334c023bf56ecdd1c8bf6d99e4f0e1f1d140c3f2a6ef84214910edc423815a1' 
  AND (
    token = 'RFYU5b3+mt29xzhJ4o80bqjCm3dZbsMAmB+JmOnd/eo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038