UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZHpzG/XRfslfWrgXklb3HbBq40dzEbobVu9jxSg/JI4=' 
WHERE 
  key_id = '5d3ba88d7966d460dff98d274bde7a2245cbdfc9946e1663843a565415371761' 
  AND (
    token = 'ZHpzG/XRfslfWrgXklb3HbBq40dzEbobVu9jxSg/JI4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025