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