UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pRvUVJwuQpJUOEkgIyE0RiGWIUy/6xGVbFFT7y5oCXo='
WHERE
key_id = '9ee0f9c827589379c09c7b507d068cebc4a3eb705ce4982b1741ce4281887346'
AND (
token = 'pRvUVJwuQpJUOEkgIyE0RiGWIUy/6xGVbFFT7y5oCXo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)