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