UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mZrWHxS1E35NBNNexlWcFnhMRGS4jJqAM8GLJpwqvnk='
WHERE
key_id = 'c8becc5c9e7689713dacf0706a51b7784e1e0364869a6a4de25604f3fa7baa10'
AND (
token = 'mZrWHxS1E35NBNNexlWcFnhMRGS4jJqAM8GLJpwqvnk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)