UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sOF12p0E32sE0Y4f+02mUYvRbTzMPLwrJqpxsbamooc=' 
WHERE 
  key_id = '0c0f8e29bec59657f5f250b687b6ede72a77331e8c7242b35a05270fa6346578' 
  AND (
    token = 'sOF12p0E32sE0Y4f+02mUYvRbTzMPLwrJqpxsbamooc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054