UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JlNSil0ge2SJo8Ot7Lwk4Gwy/rNrC4Ou31UPhdvDRUs=' 
WHERE 
  key_id = '28b024eea0c362b3c08616835f42d0110887880dcd81361353a953f839342325' 
  AND (
    token = 'JlNSil0ge2SJo8Ot7Lwk4Gwy/rNrC4Ou31UPhdvDRUs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024