UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k7lJyqbDAoql21py2sircJ47e9l88scjctescNi0XK4='
WHERE
key_id = '08c09a7355df9cbce6cbde8c6e364ff3e7f334f6c97f5d56feff39fa27177a52'
AND (
token = 'k7lJyqbDAoql21py2sircJ47e9l88scjctescNi0XK4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)