UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6K7UMquGwmId5Vr0lMIe1XP5jlvVwq3Gbf5QuzMB1Dw='
WHERE
key_id = 'f38d59ee5e64916c5d238fc2dc4187295ef78be27801b912dda51e17acd50a4a'
AND (
token = '6K7UMquGwmId5Vr0lMIe1XP5jlvVwq3Gbf5QuzMB1Dw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)