UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NRhIENzdc0Bfhipy9TpK+0lWT8JNWi6uJOm2Ti05r+E='
WHERE
key_id = '3cc87aae016e9d8f20dcd6c90626ef565bda6314d04b3dcfa1d7fc718ddabcf0'
AND (
token = 'NRhIENzdc0Bfhipy9TpK+0lWT8JNWi6uJOm2Ti05r+E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)