UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E9BdeWsmJNVSxXjCOnO4lKjUvHOuKg/vBQjcAMKvdoU='
WHERE
key_id = 'dbdd96742bdd096348b0ef5be7d915b204e444661a4b7ed5e522e6fd2e6f4ad6'
AND (
token = 'E9BdeWsmJNVSxXjCOnO4lKjUvHOuKg/vBQjcAMKvdoU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)