UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Pg7KDj8TVI6RGVySxzpIBOurbt1LTsY0bxrwUrUUWZI='
WHERE
key_id = '7c2d0a3033f0e976b42e6715e5bbd2144a8bca44628b8a561b13dbfe624aae76'
AND (
token = 'Pg7KDj8TVI6RGVySxzpIBOurbt1LTsY0bxrwUrUUWZI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)