UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Nr8+5WVjLiX89xip+Fs1JfT7a8dMgA2nFv3JiRQ1j/g=' 
WHERE 
  key_id = '780698ee7dcc41f01b1c7f219f0d54333ee5bbaaa0cdc9a079a6767d25fae10f' 
  AND (
    token = 'Nr8+5WVjLiX89xip+Fs1JfT7a8dMgA2nFv3JiRQ1j/g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022