UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4wLT3dLFuupEyDprKvJylLfmejVe11tSY5ZPoCJqEV4=' 
WHERE 
  key_id = '5e975c9320b531fda13033029da5a141ac57b2b623f96389822f3c94dca9066b' 
  AND (
    token = '4wLT3dLFuupEyDprKvJylLfmejVe11tSY5ZPoCJqEV4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018