UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xQGdTdcWH7kMvb8wQhvX3niFjQf5VUJiL/RoXScE7Q0='
WHERE
key_id = 'd6fff09a5e09bdcd8015a7ef6313e45250fe36a053b5e5aff91e837db47cfedc'
AND (
token = 'xQGdTdcWH7kMvb8wQhvX3niFjQf5VUJiL/RoXScE7Q0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)