UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'drxIbPWUQal7tYuUSUXRg5J2RsU+EDBOsKQMX+iyx2A=' 
WHERE 
  key_id = '245e42b6fd5ddc85ec19196b18a4d812b9670ef511bd81e5b78bbd7b01f71df6' 
  AND (
    token = 'drxIbPWUQal7tYuUSUXRg5J2RsU+EDBOsKQMX+iyx2A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026