UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sG1jIKL+tkuOUmak3b2FgZsLCqJJ7KXer8RNhGKzg9U='
WHERE
key_id = '663461b4785d29a4363377219b372ae1041766c83dc1d49d48122a3bb3d226a9'
AND (
token = 'sG1jIKL+tkuOUmak3b2FgZsLCqJJ7KXer8RNhGKzg9U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)