UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kkvz+B8j8oPKsX4Vo5jXntKJoGIMAaE78BuXtJE90ZA='
WHERE
key_id = '850a99a64d35b1dff3a82ddf0d7708e7891074711371453649d0150a476b55a2'
AND (
token = 'kkvz+B8j8oPKsX4Vo5jXntKJoGIMAaE78BuXtJE90ZA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)