UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tcDozo2m12CH+aP86ZgwTxdSaDIpwqOkuN4kbsxHx40=' 
WHERE 
  key_id = '10a6df706644dc2e1274330d45a258689a4fcc73392a51750e424ec135965098' 
  AND (
    token = 'tcDozo2m12CH+aP86ZgwTxdSaDIpwqOkuN4kbsxHx40=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051