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