UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QtIsoiLJ/cNIudEFyHjBBo0sX5Qf9JlJKhcWCVD7tm4=' 
WHERE 
  key_id = 'dfb50321225a290e871476220a4d544b433d21ae46f2fb58727de4943b490995' 
  AND (
    token = 'QtIsoiLJ/cNIudEFyHjBBo0sX5Qf9JlJKhcWCVD7tm4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026