UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wr+KMjqgb4Ola4mm83ZOK+6P7RDlNpw+MTiB8h9lVRs=' 
WHERE 
  key_id = '11f504e58c83ecaf90441acff2d2fb91aa1569784477cde04b07d87d43fbe5f4' 
  AND (
    token = 'wr+KMjqgb4Ola4mm83ZOK+6P7RDlNpw+MTiB8h9lVRs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030