UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r9rCAOq8j9gfZRvb9PfbIC6WsfWqL03i0JEP77oTd+Q='
WHERE
key_id = '38f31ec3321ac0bb236e92235cec9da017f6cb471c3f64e4978123e279a8e3d6'
AND (
token = 'r9rCAOq8j9gfZRvb9PfbIC6WsfWqL03i0JEP77oTd+Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)