UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NJQ17IfsxbNRErHB5Qphng+d9cON5/4l1PaeQ7TJp9s=' 
WHERE 
  key_id = 'd58f46046c753a412ae233fc32b61753662e8bf559cb89f398ea3d0266b2298a' 
  AND (
    token = 'NJQ17IfsxbNRErHB5Qphng+d9cON5/4l1PaeQ7TJp9s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017