UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tekrnOxF8wix836BLV8lRQ4SBLRXY7RsamAtwiFNiqY='
WHERE
key_id = '1b644d7c6581cd251e43bafd8696b9413836d07d49deb1a55dedc43be021f9db'
AND (
token = 'tekrnOxF8wix836BLV8lRQ4SBLRXY7RsamAtwiFNiqY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)