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