UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/rRnNXw7sQJsSghgu6YQKZbXxV0CvpMl/Phd1mzgvn4='
WHERE
key_id = 'd1e9619495cbf0320ddcadddd070edcdf3f7250d592d7890c55d60fd9b302f60'
AND (
token = '/rRnNXw7sQJsSghgu6YQKZbXxV0CvpMl/Phd1mzgvn4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)