UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RP7p9JbadXd7PPeN/cofGCKR6jrf5iiAetPQ/DEj7cY=' 
WHERE 
  key_id = '9f0811d687b8bda47607a13fc57ca92d72d659b7647599f8256beaf938a8b59f' 
  AND (
    token = 'RP7p9JbadXd7PPeN/cofGCKR6jrf5iiAetPQ/DEj7cY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026