UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2H5sdiRNXYCmIZ+HYUozH1dIYgkLd9DRyAKi5iUbVO4='
WHERE
key_id = 'e3d7580be45b10a2793246b7f38d168c78de31d3d947a6dd0b6eabcd958372b8'
AND (
token = '2H5sdiRNXYCmIZ+HYUozH1dIYgkLd9DRyAKi5iUbVO4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)