UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9Vftw5mdcWjBZu+J0o2JLCXD9w7m+cMkBYsxAh+E9NU='
WHERE
key_id = '2ca40e775923afc7d6df0aa00cd83952ddf508e1f55d6e05dd01b129d3318b7c'
AND (
token = '9Vftw5mdcWjBZu+J0o2JLCXD9w7m+cMkBYsxAh+E9NU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)